const AccountDao = require('../dao/accountDao');
exports.login = function (params) {
    return new Promise(function (resolve,reject) {
        AccountDao.queryAccount(masterPool,params)
            .then(function (result) {
                if(result.length>0){
                    if(result[0].Password == params.Password)
                        return result[0];
                    throw {code:301};
                }else{
                    throw {code:300};
                }
            })
            .then(resolve,reject);
    });
};

exports.update = function (params) {
    return new Promise(function (resolve,reject) {
        AccountDao.updateAccount(masterPool,params)
            .then(resolve,reject);
    });
};